<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
    <script src="../lib/vue.js"></script>
  </head>

  <body>
    <div id="app">
      <my_cpn></my_cpn>
    </div>

    <script>
      //1.创建子组件
      const cpnC = Vue.extend({
        template: `
        <div>
        <h2>我是子组件</h2>
        <p>我是子内容</p>
        </div>`
      })
      //2.创建父组件
      const cpnP = Vue.extend({
        template: `
        <div>
        <h2>我是父组件</h2>
        <p>我是父内容</p>
        <my_cpn></my_cpn>
        </div>`,
        components: {
          my_cpn: cpnC
        }
      })

      var vm = new Vue({
        el: '#app',
        data: {},
        methods: {},
        components: {
          //局部组件
          my_cpn: cpnP
        }
      })
    </script>
  </body>
</html>
